//
//  UILabel+Extension.swift
//  SinaWeibo
//
//  Created by 张子国 on 15/11/13.
//  Copyright © 2015年 张子国. All rights reserved.
//

import UIKit
extension UILabel {
    convenience init(title:String, size:CGFloat, color:UIColor, margin : CGFloat = 0){
        self.init()
        text = title
        textAlignment = NSTextAlignment.Center
        font = UIFont.systemFontOfSize(size)
        textColor = color
        numberOfLines = 0
        
        if margin != 0 {
            preferredMaxLayoutWidth = screenW - 2 * margin
            textAlignment = NSTextAlignment.Left

        }
        //设置大小
        sizeToFit()

    }
}
